import React, { Component } from 'react';
import { connect } from 'dva';
import { Input } from 'antd';
import router from 'umi/router';
import { formatMessage } from 'umi/locale'
import PageHeaderWrapper from '@/components/PageHeaderWrapper';

@connect()
class WebSite extends Component {
  handleTabChange = key => {
    const { match } = this.props;
    switch (key) {
      case 'base':
        router.push(`${match.url}/base`);
        break;
      case 'content':
        router.push(`${match.url}/content`);
        break;
      case 'user':
        router.push(`${match.url}/user`);
        break;
      default:
        break;
    }
  }

  handleFormSubmit = (value) => {
    // eslint-disable-next-line
    console.log(value);
  }

  render() {
    const tabList = [{
      key: 'base',
      tab: formatMessage({ id: 'menu.system.setting.website.base' }, {}),
    }, {
      key: 'content',
      tab: formatMessage({ id: 'menu.system.setting.website.content' }, {}),
    }, {
      key: 'user',
      tab: formatMessage({ id: 'menu.system.setting.website.user' }, {}),
    }];

    const { match, children, location } = this.props;

    return (
      <PageHeaderWrapper
        tabList={tabList}
        tabActiveKey={location.pathname.replace(`${match.path}/`, '')}
        onTabChange={this.handleTabChange}
      >
        {children}
        {/* <Switch>
          {routes.map(item => (
            <Route key={item.key} path={item.path} component={item.component} exact={item.exact} />
          ))}
        </Switch> */}
      </PageHeaderWrapper>
    );
  }
}

export default WebSite;